package com.lanou.mapper;

import com.lanou.bean.ShoppingBean;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Created by dllo on 18/3/19.
 */
public interface ShoppingOrdersMapper{
    /**
     * 由购物车生成订单
     * @param cartID
     * @param shoppingStatus_id
     */
    void updateShoppingStatusByCartID(@Param("cartID") Integer cartID,
                                      @Param("userID") Integer userID,
                                      @Param("shoppingStatus_id") Integer shoppingStatus_id);

    /**
     * 查用户订单
     * @param userID
     * @return
     */
    List<ShoppingBean> queryShoppingOrdersByUserID(@Param("userID") Integer userID,
                                                   @Param("shoppingStatus_id") Integer shoppingStatus);

    /**
     * @desc 按购物车id查购买数量
     * @param cartID
     * @return
     */
    ShoppingBean queryStockByCartID(@Param("cartID") Integer cartID);

    /**
     * @desc 根据商品id改库存和销量
     * @param commodity_id
     * @param count
     */
    void updateStockByCommodityID(@Param("commodity_id") Integer commodity_id,
                                  @Param("count") Integer count);
}
